<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('')" />
<th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
	<div class="row">
		<div class="col-md-6">
			<div class="ibox float-e-margins">
				<div class="ibox-title">
					<h5>告警信息</h5>
				</div>
				<div class="ibox-content">
					<div class="table-responsive">
						<table class="table table-bordered table-striped">
							<thead>
								<tr>
									<th>衡器：</th>
									<th><span th:text='${waInfoMap.waname+"("+alarmMap.waCode+")" }'></span></th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<th class="text-nowrap">要素：</th>
									<td><span th:text='${alarmMap.ename+"("+alarmMap.code+")" }'></span></td>
								</tr>
								<tr>
									<th class="text-nowrap">序号：</th>
									<td><span th:text='${alarmMap.orderNum }'></span></td>
								</tr>
								<tr>
									<th class="text-nowrap">告警值：</th>
									<td><span th:text='${alarmMap.value }'></span></td>
								</tr>
								<tr>
									<th class="text-nowrap">描述：</th>
									<td><span th:text='${alarmMap.message }'></span></td>
								</tr>
								<tr>
									<th class="text-nowrap">时间：</th>
									<td class="text-muted"><span th:text='${alarmMap.time }'></span></td>
								</tr>
								<tr>
									<th class="text-nowrap">系统建议：</th>
									<td>
										<div th:each='o,stat:${sysHandleOptions}'
											th:utext="${o.handling_opinions}"></div>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
		<div class="col-md-6">
			<div class="ibox float-e-margins">
				<div class="ibox-title">
					<h5>工单信息</h5>
				</div>
				<div class="ibox-content">
					<div class="table-responsive">
						<form class="form-horizontal m" id="form-workOrder-add">
							<div class="form-group">
								<label class="col-sm-3 control-label">工单类型：</label>
								<div class="col-sm-3">
									<select name="workorderType" class="form-control m-b" th:with="type=${@commdict.getDictList('sys_dict_data,dict_value,dict_label,dict_type=semicolonwork_order_typesemicolon and dict_value=semicolon'+workOrderMap.type+'semicolon')}" required readonly>
		                        		<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:selected="${dict.dictValue==workOrderMap.type}"></option>
		                    		</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">指导建议：</label>
								<div class="col-sm-8">
									<textarea class="form-control" th:text='${workOrderMap.handling_opinions}' rows="5" readonly="readonly"></textarea>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label is-required">处理结果：</label>
								<div class="col-sm-8">
									<input name="workOrderId" type="hidden"
										th:value="${workOrderMap.id}"> <select name='state'
										lay-filter='state' required>
										<option value='1'>处理成功</option>
										<option value='2'>处理失败</option>
										<option value='3'>忽略</option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label is-required">处理方法：</label>
								<div class="col-sm-8">
									<textarea name="handleContent" class="form-control" required rows="5"></textarea>
								</div>
							</div>
							<div class="form-group">    
				                <label class="col-sm-3 control-label">视频图片：</label>
				                <div class="col-sm-8">
				                    <input type="hidden" name="files">
				                    <div class="file-loading">
				                        <input class="form-control file-upload" id="files" name="file" type="file">
				                    </div>
				                </div>
				            </div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: bootstrap-fileinput-js"/>
	<script th:inline="javascript">
		var alarmMap = [[${alarmMap}]];
		var prefix = ctx + "realtime"
		$("#form-workOrder-add").validate({
			focusCleanup : true
		});
		
		$(".file-upload").fileinput({
            uploadUrl: ctx + 'common/upload',
            maxFileCount: 1,
            autoReplace: true,
            allowedFileTypes:['image'],
            allowedFileExtensions:['jpg','png'],
        }).on('fileuploaded', function (event, data, previewId, index) {
            $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
        }).on('fileremoved', function (event, id, index) {
            $("input[name='" + event.currentTarget.id + "']").val('')
        })
        
		function submitHandler() {
			if ($.validate.form()) {
				$.operate.save(prefix + "/workOrderHandle", $('#form-workOrder-add')
						.serialize());
			}
		}
		function openWorkOrderHandleHis(){
			$.modal.open('工单处理历史', prefix + '/toWorkOrderHandleHis?code=' + alarmMap.code, '1300', '700');
		}
	</script>
</body>
</html>